#include "ctextitem.h"

#include <buola/image/cimage.h>
#include <buola/image/cfont.h>
#include <buola/image/cgc.h>

namespace buola { namespace bdesktop {

CTextItem::CTextItem(const std::wstring &pString)
    :   mString(pString)
{
}

CTextItem::~CTextItem()
{
}

double CTextItem::GetWidth()
{
    return CFont::GetStock(L"nicebig")->GetWidth(mString)+16;
}

void CTextItem::Draw(CGC *pGC)
{
    pGC->SetStockFont(L"nicebig");
    CPoint lPos(mPos.l+8,(mPos.t+mPos.b)/2-2);
    pGC->SetSourceColor(CColor(0.2,0.2,0.2,1.0));
    pGC->DrawText(lPos+1,mString,NFont::VCENTER);
    pGC->SetSourceColor(CColor(0.9,0.9,0.9,1.0));
    pGC->DrawText(lPos,mString,NFont::VCENTER);
}

void CTextItem::OnClick(gui::CMouseEvent *pE)
{
    if(pE->mButton==gui::MOUSE_LEFT)
        sClicked();
}

/*namespace bdesktop*/ } /*namespace buola*/ }
